<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<TITLE>
XBeeXmppUtil
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="XBeeXmppUtil";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppPacket.html" title="class in com.rapplogic.xbee.xmpp"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?com/rapplogic/xbee/xmpp/XBeeXmppUtil.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="XBeeXmppUtil.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.rapplogic.xbee.xmpp</FONT>
<BR>
Class XBeeXmppUtil</H2>
<PRE>
java.lang.Object
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.rapplogic.xbee.xmpp.XBeeXmppUtil</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>XBeeXmppUtil</B><DT>extends java.lang.Object</DL>
</PRE>

<P>
<HR>

<P>

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#XBeeXmppUtil()">XBeeXmppUtil</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#convertHexStringToIntArray(java.lang.String)">convertHexStringToIntArray</A></B>(java.lang.String&nbsp;message)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Extracts an XBeeResponse (client) or XBeeRequest (gateway) packet from a smack message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#convertIntArrayToHexString(int[])">convertIntArrayToHexString</A></B>(int[]&nbsp;arr)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Formats a byte array in hex, without the "0x" notation.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;com.rapplogic.xbee.api.XBeeResponse</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#decodeXBeeResponse(int[])">decodeXBeeResponse</A></B>(int[]&nbsp;packet)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;com.rapplogic.xbee.api.XBeeResponse</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#decodeXBeeResponse(java.lang.String)">decodeXBeeResponse</A></B>(java.lang.String&nbsp;message)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts the incoming XMPP ascii message into an XBeeResponse object instance</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#encodeXBeeRequest(com.rapplogic.xbee.api.XBeeRequest)">encodeXBeeRequest</A></B>(com.rapplogic.xbee.api.XBeeRequest&nbsp;request)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts an XBeeRequest into an ASCII representation, to be sent over XMPP</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#getDifferentFrameId(int)">getDifferentFrameId</A></B>(int&nbsp;last)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a random frame id that is not equal to one provided</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#getRandomFrameId()">getRandomFrameId</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a random frame id between 1 and 255</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppUtil.html#padHex(int)">padHex</A></B>(int&nbsp;b)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The hex string must 2 chars per byte for it to be parsed correctly, 
 so 0x1 is represented as 01</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="XBeeXmppUtil()"><!-- --></A><H3>
XBeeXmppUtil</H3>
<PRE>
public <B>XBeeXmppUtil</B>()</PRE>
<DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="encodeXBeeRequest(com.rapplogic.xbee.api.XBeeRequest)"><!-- --></A><H3>
encodeXBeeRequest</H3>
<PRE>
public static java.lang.String <B>encodeXBeeRequest</B>(com.rapplogic.xbee.api.XBeeRequest&nbsp;request)</PRE>
<DL>
<DD>Converts an XBeeRequest into an ASCII representation, to be sent over XMPP
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>request</CODE> - 
<DT><B>Returns:</B><DD></DL>
</DD>
</DL>
<HR>

<A NAME="decodeXBeeResponse(java.lang.String)"><!-- --></A><H3>
decodeXBeeResponse</H3>
<PRE>
public static com.rapplogic.xbee.api.XBeeResponse <B>decodeXBeeResponse</B>(java.lang.String&nbsp;message)
                                                              throws <A HREF="../../../../com/rapplogic/xbee/xmpp/DecodeException.html" title="class in com.rapplogic.xbee.xmpp">DecodeException</A></PRE>
<DL>
<DD>Converts the incoming XMPP ascii message into an XBeeResponse object instance
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>message</CODE> - 
<DT><B>Returns:</B><DD>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../com/rapplogic/xbee/xmpp/DecodeException.html" title="class in com.rapplogic.xbee.xmpp">DecodeException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="decodeXBeeResponse(int[])"><!-- --></A><H3>
decodeXBeeResponse</H3>
<PRE>
public static com.rapplogic.xbee.api.XBeeResponse <B>decodeXBeeResponse</B>(int[]&nbsp;packet)
                                                              throws <A HREF="../../../../com/rapplogic/xbee/xmpp/DecodeException.html" title="class in com.rapplogic.xbee.xmpp">DecodeException</A></PRE>
<DL>
<DD><DL>

<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../com/rapplogic/xbee/xmpp/DecodeException.html" title="class in com.rapplogic.xbee.xmpp">DecodeException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="convertHexStringToIntArray(java.lang.String)"><!-- --></A><H3>
convertHexStringToIntArray</H3>
<PRE>
public static int[] <B>convertHexStringToIntArray</B>(java.lang.String&nbsp;message)
                                        throws <A HREF="../../../../com/rapplogic/xbee/xmpp/DecodeException.html" title="class in com.rapplogic.xbee.xmpp">DecodeException</A></PRE>
<DL>
<DD>Extracts an XBeeResponse (client) or XBeeRequest (gateway) packet from a smack message.  
 Each message contains a packet formated in hex, e.g. (001eff..)
<P>
<DD><DL>

<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../../com/rapplogic/xbee/xmpp/DecodeException.html" title="class in com.rapplogic.xbee.xmpp">DecodeException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="convertIntArrayToHexString(int[])"><!-- --></A><H3>
convertIntArrayToHexString</H3>
<PRE>
public static java.lang.String <B>convertIntArrayToHexString</B>(int[]&nbsp;arr)</PRE>
<DL>
<DD>Formats a byte array in hex, without the "0x" notation.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>arr</CODE> - 
<DT><B>Returns:</B><DD></DL>
</DD>
</DL>
<HR>

<A NAME="padHex(int)"><!-- --></A><H3>
padHex</H3>
<PRE>
public static java.lang.String <B>padHex</B>(int&nbsp;b)</PRE>
<DL>
<DD>The hex string must 2 chars per byte for it to be parsed correctly, 
 so 0x1 is represented as 01
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - 
<DT><B>Returns:</B><DD></DL>
</DD>
</DL>
<HR>

<A NAME="getRandomFrameId()"><!-- --></A><H3>
getRandomFrameId</H3>
<PRE>
public static int <B>getRandomFrameId</B>()</PRE>
<DL>
<DD>Returns a random frame id between 1 and 255
<P>
<DD><DL>

<DT><B>Returns:</B><DD>Jan 24, 2009</DL>
</DD>
</DL>
<HR>

<A NAME="getDifferentFrameId(int)"><!-- --></A><H3>
getDifferentFrameId</H3>
<PRE>
public static int <B>getDifferentFrameId</B>(int&nbsp;last)</PRE>
<DL>
<DD>Returns a random frame id that is not equal to one provided
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>last</CODE> - 
<DT><B>Returns:</B><DD>Jan 24, 2009</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/rapplogic/xbee/xmpp/XBeeXmppPacket.html" title="class in com.rapplogic.xbee.xmpp"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html?com/rapplogic/xbee/xmpp/XBeeXmppUtil.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="XBeeXmppUtil.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

</BODY>
</HTML>
